<template>
		<div class="wrapper emptyWrapper">
             <div v-if="this.$route.params.sort==0">
                 <ProductItem :products="category_list[0]" />
             </div>
             <div v-if="this.$route.params.sort==1">
                 <ProductItem :products="category_list[1]" />
             </div>
             <div v-if="this.$route.params.sort==2">
                 <ProductItem :products="category_list[2]" />
             </div>
             <div v-if="this.$route.params.sort==3">
                 <ProductItem :products="category_list[3]" />
             </div>
		</div> 
</template>
<script>
     import { getHomeData,getVegetables} from './../../../service/api/index.js'
     import ProductItem from './ProductItem'
     export default{
	       name:"ContentView",
	       props:{
               
	       },    


           data(){
            return {
               category_list:'',
               products:''
            }
           },
	       components:{
	       	   ProductItem
	         },


          created(){
          //  console.log(this.$route);
           //2.请求网络数据   调用getVegetables返回promise对象，然后可以调用promise的then方法，返回请求到的数据(response.data)
                  getVegetables().then((response)=>{
                  if (response.success) {
                       this.category_list = response.data.pzleixing_list;
                       // console.log(this.category_list);
                  }
             }).catch(error=>{
                   // todo......
                  console.log(error);
             })   //---catch


        }, // ----created
         
       }
</script>
<style lang="less" scoped>
        .wrapper {
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overflow-scrolling: touch;
        }

        .wrapper {
            position: absolute;
            left: 4.9rem;
            right: 0;
            bottom: 0;
            top: 10px;
            background: #f5f5f5;
        }
</style>



